<template>
  <div>
    <div class="app-container" v-loading.fullscreen.lock="fullscreenLoading">
      <div style="margin-top: 15px;margin-bottom: 15px;">
        <span style="font-size: 20px;color: #00afff;">
          <b>查看检查详情</b>
        </span>
      </div>
      <div style="background-color: white;padding: 15px 15px 15px 15px">
        <el-button type="primary" endicon="el-icon-plus" size="mini" style="width: 60px"
                   @click="closePage">返回
        </el-button>
        <el-form ref="form" :model="formData">
          <el-row>
            <div>
              <el-col style="margin-top: 20px" :span="24">
                <span><b>{{ checkRecord.checkType.checkName }}——{{ checkRecord.schoolName }}</b></span>
              </el-col>
              <el-col style="margin-top: 10px;" :span="24">
                <div style="height: 1px;background-color: #afafaf"/>
              </el-col>
              <el-col style="margin: 15px 0px;" :span="6">
                <span style="font-size: 14px;color: #666666">检查时间：{{
                    checkRecord.answerDate ? checkRecord.answerDate : "待检查"
                  }}</span>
              </el-col>
              <el-col style="margin: 15px 0px;" :span="6">
                <span style="font-size: 14px;color: #666666">检查人：{{
                    checkRecord.informant ? checkRecord.informant : "待检查"
                  }}</span>
              </el-col>
            </div>

            <div v-for="(domain, index) in formData.formList" :key="index">
              <el-col :space="24">
                <div style="background-color: #EDF1F2;padding: 20px 20px;margin-top: 10px">
                  <div>
                      <span style="color: #333333 ;font-size: 16px">
                  {{ index + 1 + "." + domain.questionName }}
                </span>
                  </div>
                  <div style="padding-left: 10px;margin-top: 6px">
                    <div style="margin-top: 10px">
                      <span style="color: #333333;font-size: 14px">回复：{{
                          domain.answerResult ? domain.answerResult : "待检查"
                        }}</span>
                    </div>
                  </div>
                </div>
              </el-col>
            </div>
          </el-row>
        </el-form>
        <el-row>
          <el-col style="margin-top: 20px" :span="24">
            <el-button @click="closePage">关闭</el-button>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import {listCheckAnswer} from "@/api/patrol/checkAnswer";

export default {
  name: "see",
  data() {
    return {
      fullscreenLoading: false,
      checkRecord: {},
      formData: {
        formName: '测试',
        time: null,
        fillTimeLimit: null,
        fillinperson: '测试',
        formList: []
      }
    };
  },
  created() {
    this.fullscreenLoading = true;
    let checkRecord = JSON.parse(decodeURI(this.$route.query.checkRecord))
    this.checkRecord = checkRecord
    console.log(checkRecord)
    this.getList();
  },
  methods: {
    getList() {
      listCheckAnswer({
        checkRecordId: this.checkRecord.id
      }).then(res => {
        console.log(res)
        this.formData.formList = res.rows
      })
      this.fullscreenLoading = false;
    },
    closePage() {
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.go(-1)
      // this.$tab.openPage("专项检查", "/form/viewCheck");
    },
  },
};
</script>

<style scoped>
.app-container {
  background-color: #edf1f2;
  padding: 10px;
  min-height: calc(100vh - 35px)
}

::v-deep.pagination-container .el-pagination {
  text-align: center;
  position: sticky;
}

::v-deep.el-form-item {
  margin-bottom: 0;
}
</style>
